package com.zsrt.oa;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class CookiesLogin
 */
public class CookiesLogin extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    @Override
	protected void service(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException {
    	
    	String username = request.getParameter("username");
    	String password = request.getParameter("password");
    	if("luo".equals(username) && "123".equals(password)){
    		Cookie cookie = new Cookie(username, password);
    		cookie.setMaxAge(60);
    		response.addCookie(cookie);
    	}
	}

}
